<?php
include("include/config.inc.php");
if(!isset($_SESSION['s_activId']))
{
  header("location:checklogin.php");
}
$purchseDetailArray = array();
$i = 0;
$selectPurchse = "SELECT purchaseDetailId,quantity,fat,fatRate,rate,amount,itemName
                     FROM  purchasedetail
                   LEFT JOIN  item ON item.itemId = purchasedetail.itemId
                   WHERE purchaseMasterId = ".$_REQUEST['purchaseMasterId']."
                    ORDER BY purchaseMasterId";
$selectPurchseRes = mysql_query($selectPurchse);
while($purchaseRow = mysql_fetch_array($selectPurchseRes))
{
  $purchseDetailArray[$i]['purchaseDetailId']   = $purchaseRow['purchaseDetailId'];
  $purchseDetailArray[$i]['itemName']           = $purchaseRow['itemName'];
  $purchseDetailArray[$i]['quantity']           = $purchaseRow['quantity'];
  $purchseDetailArray[$i]['fat']                = $purchaseRow['fat'];
  $purchseDetailArray[$i]['fatRate']            = $purchaseRow['fatRate'];
  $purchseDetailArray[$i]['rate']               = $purchaseRow['rate'];
  $purchseDetailArray[$i]['amount']             = $purchaseRow['amount'];
  $i++;
}

include("./bottom.php");
$smarty->assign("purchseDetailArray",$purchseDetailArray);  
$smarty->display('purchseDetail.tpl');
?>